package group.program.register.username;

import group.program.Controller.RegisterController;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.MockitoAnnotations;
import static org.junit.jupiter.api.Assertions.*;

class format {
    @InjectMocks
    private RegisterController registerController;

    @BeforeEach
    void setUp() {
        MockitoAnnotations.openMocks(this);
    }

    @Test
    void testValidateUsernameFormat() {
        String validUserName = "John";
        assertNull(registerController.validateUserNameFormat(validUserName));
    }

    @Test
    void testInvalidUserNameFormat() {
        String invalidUserName = "John1";
        assertEquals("用户名只能由英文字母组成", registerController.validateUserNameFormat(invalidUserName));
    }
}
